﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Specialized;

namespace Patrick.Custom {
	/// <summary>
	/// Js 的摘要说明
	/// </summary>
	public class Js {
		public Js() {
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}



		public static void Alert(string Msg, bool Flush) {
			HttpContext.Current.Response.Write("<script type=\"text/javascript\">alert('" + Msg + "');</script>");
			if (Flush) HttpContext.Current.Response.Flush();
		}
		public static void Alert(string Msg) {
			Alert(Msg, false);
		}



		public static void Redirect(string Address, bool Flush) {
			HttpContext.Current.Response.Write("<script type=\"text/javascript\">window.location.href = '" + Address + "';</script>");
			if (Flush) HttpContext.Current.Response.Flush();
		}
		public static void Redirect(string Address) {
			Redirect(Address, false);
		}



		public static void Back(bool Flush) {
			HttpContext.Current.Response.Write("<script type=\"text/javascript\">history.back();</script>");
			if (Flush) HttpContext.Current.Response.Flush();
		}
		public static void Back() {
			Back(false);
		}



		public static void Run(string Script, bool Flush) {
			HttpContext.Current.Response.Write("<script type=\"text/javascript\">" + Script + "</script>");
			if (Flush) HttpContext.Current.Response.Flush();
		}
		public static void Run(string Script) {
			Run(Script, false);
		}
	}
}